---
title: Serialize import metadata to key-value text
summary: Renders a populated clsImageImport instance as a flat KEY=VALUE text payload for an external imaging system.
status: draft
owner: SAIF Claims BOF team
last_reviewed: 2026-08-21
library: SAIF.Services.Imaging.Import
reference_type: embedded
operation_id: OP-IMG-001
trigger: Caller invokes clsImageImport.ToString()
---

# Serialize import metadata to key-value text

This operation builds the `KEY=VALUE\r\n`-delimited text payload that a calling library (e.g. `SAIF.Services.Printing`) delivers to the external imaging system (presumed OnBase, inferred from constant naming*), by appending one line per public property of a populated `clsImageImport` instance.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-IMG-001 |
| **Trigger** | Caller calls `.ToString()` on a populated `clsImageImport` instance |
| **Inputs** | All public property values of the `clsImageImport` instance |
| **Outputs** | A single `String` containing `KEY=VALUE` lines separated by `vbCrLf` |
| **Primary components** | `clsImageImport.ToString` |
| **Entry point** | `SAIF.Services.Imaging.Import\clsImageImport.vb` |

## Steps

1. Append `BATID`, `CLAIMID`, `CLAIMNUM` lines unconditionally from `BatID`/`ClaimID`/`ClaimNum`.
2. Append `CommentText`, `CreateUser`, `DiscoveryFlag`, `DisplayField1/2/3` lines unconditionally.
3. Append the `DocumentDate` line ([BR-IMG-001](../business-rules.md#br-img-001-blank-out-unset-date-values-in-serialized-output)).
   - If `DocumentDate` equals `Date.MinValue` or `Date.MaxValue` (unset sentinel): emit a blank value instead of a formatted date.
4. Append the `DocumentDateDays` line ([BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output)).
   - If `DocumentDateDays` is not greater than `0`: emit a blank value.
5. Append `ImageFileCode`, `ImageCategoryCode`, `ImageDocumentTypeCode`, `ImageDeleteFlag`, `ImageIndexFlag` lines unconditionally.
6. Append the `ImageSeqNum` line ([BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output)).
   - If `ImageSeqNum` is not greater than `0`: emit a blank value.
7. Append the `NPages` line ([BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output)).
   - If `NPages` is not greater than `0`: emit a blank value.
8. Append the `PolicyNum` line ([BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output)).
   - If `PolicyNum` is not greater than `0`: emit a blank value.
9. Append the `ReceivedDate` line ([BR-IMG-001](../business-rules.md#br-img-001-blank-out-unset-date-values-in-serialized-output)).
   - If `ReceivedDate` equals `Date.MinValue` or `Date.MaxValue` (unset sentinel): emit a blank value.
10. Append `SLevel`, `ImageDocumentNameCode`, `ExternalViewCode`, `SystemGeneratedFlag`, `AgencyID`, `ProducerID`, `GroupAssociationCode`, `Spec` lines unconditionally.
11. Append the `TaskCategory` line unconditionally.
12. Append the `TaskDate` line ([BR-IMG-001](../business-rules.md#br-img-001-blank-out-unset-date-values-in-serialized-output)).
    - If `TaskDate` equals `Date.MinValue` or `Date.MaxValue` (unset sentinel): emit a blank value.
13. Append `TaskMailIDList`, `TaskPriority`, `TaskSecurity`, `TaskText`, `PolicyAccount`, `PolicySecuredFlag` lines unconditionally.
14. Append the `AffiliationId` line ([BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output)).
    - If `AffiliationId` is not greater than `0`: emit a blank value.
15. Append the `LegalCaseId` line ([BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output)).
    - If `LegalCaseId` is not greater than `0`: emit a blank value.
16. Append `LegalCaseNum`, `LegalCopyToClaimFlag`, `LegalDistributionFlag` lines unconditionally.
17. Return the fully-built string to the caller, who is responsible for delivering it to the external imaging system.*

This operation performs no delegation into any referenced library — it is a pure in-memory string-building routine over the instance's own properties.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([ToString invoked]) --> S1[Append identity/claim/policy fields]
	S1 --> S2{Date field at<br>sentinel value?}
	S2 -->|Yes| S2a[Emit blank value]
	S2 -->|No| S2b[Emit formatted date]
	S2a --> S3
	S2b --> S3[Append remaining fields]
	S3 --> S4{Numeric field<br>not greater than 0?}
	S4 -->|Yes| S4a[Emit blank value]
	S4 -->|No| S4b[Emit numeric value]
	S4a --> S5
	S4b --> S5[Append legal-case fields]
	S5 --> Done([Return KEY=VALUE text payload])
```

## Failure and edge-case behavior

- Unset date properties (`DocumentDate`, `ReceivedDate`, `TaskDate` at `Date.MinValue`/`Date.MaxValue`) never raise an exception — they are blanked per [BR-IMG-001](../business-rules.md#br-img-001-blank-out-unset-date-values-in-serialized-output).
- Unassigned numeric identifiers/counts (`DocumentDateDays`, `ImageSeqNum`, `NPages`, `PolicyNum`, `AffiliationId`, `LegalCaseId` at `0` or negative) never raise an exception — they are blanked per [BR-IMG-002](../business-rules.md#br-img-002-blank-out-non-positive-numeric-defaults-in-serialized-output).
- No other validation exists; string/flag properties (e.g., `ClaimID`, `AgencyID`, `ProducerID`) are emitted as-is even if left at their default (empty) values.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- `SAIF.Services.Imaging.Import\clsImageImport.vb`
- `.saifdocgen\state\runs\20260821-113120-claims-bof-web-legal\analysis\TSK010-analysis.md`
